﻿using System;
using System.IO;
using UnityEngine;

// Token: 0x02000286 RID: 646
[Serializable]
public class HSColorSet
{
	// Token: 0x1700022F RID: 559
	// (get) Token: 0x06000FCF RID: 4047 RVA: 0x00073C0C File Offset: 0x00071E0C
	public Color rgbaDiffuse
	{
		get
		{
			return global::HsvColor.ToRgba(this.hsvDiffuse, this.alpha);
		}
	}

	// Token: 0x17000230 RID: 560
	// (get) Token: 0x06000FD0 RID: 4048 RVA: 0x00073C20 File Offset: 0x00071E20
	public Color rgbDiffuse
	{
		get
		{
			return global::HsvColor.ToRgb(this.hsvDiffuse);
		}
	}

	// Token: 0x17000231 RID: 561
	// (get) Token: 0x06000FD1 RID: 4049 RVA: 0x00073C30 File Offset: 0x00071E30
	public Color rgbSpecular
	{
		get
		{
			return global::HsvColor.ToRgb(this.hsvSpecular);
		}
	}

	// Token: 0x06000FD2 RID: 4050 RVA: 0x00073C40 File Offset: 0x00071E40
	public static bool CheckSameColor(global::HSColorSet a, global::HSColorSet b, bool hsv, bool alpha, bool specular)
	{
		if (alpha && a.alpha != b.alpha)
		{
			return false;
		}
		if (hsv && (a.hsvDiffuse.H != b.hsvDiffuse.H || a.hsvDiffuse.S != b.hsvDiffuse.S || a.hsvDiffuse.V != b.hsvDiffuse.V))
		{
			return false;
		}
		if (specular)
		{
			if (a.specularIntensity != b.specularIntensity)
			{
				return false;
			}
			if (a.specularSharpness != b.specularSharpness)
			{
				return false;
			}
			if (a.hsvSpecular.H != b.hsvSpecular.H || a.hsvSpecular.S != b.hsvSpecular.S || a.hsvSpecular.V != b.hsvSpecular.V)
			{
				return false;
			}
		}
		return true;
	}

	// Token: 0x06000FD3 RID: 4051 RVA: 0x00073D40 File Offset: 0x00071F40
	public virtual void SetDiffuseRGBA(Color rgba)
	{
		this.hsvDiffuse = global::HsvColor.FromRgb(rgba);
		this.alpha = rgba.a;
	}

	// Token: 0x06000FD4 RID: 4052 RVA: 0x00073D5C File Offset: 0x00071F5C
	public virtual void SetDiffuseRGB(Color rgb)
	{
		this.hsvDiffuse = global::HsvColor.FromRgb(rgb);
		this.alpha = 1f;
	}

	// Token: 0x06000FD5 RID: 4053 RVA: 0x00073D78 File Offset: 0x00071F78
	public virtual void SetSpecularRGB(Color rgb)
	{
		this.hsvSpecular = global::HsvColor.FromRgb(rgb);
	}

	// Token: 0x06000FD6 RID: 4054 RVA: 0x00073D88 File Offset: 0x00071F88
	public virtual void Copy(global::HSColorSet src)
	{
		this.hsvDiffuse = new global::HsvColor(src.hsvDiffuse.H, src.hsvDiffuse.S, src.hsvDiffuse.V);
		this.alpha = src.alpha;
		this.hsvSpecular = new global::HsvColor(src.hsvSpecular.H, src.hsvSpecular.S, src.hsvSpecular.V);
		this.specularIntensity = src.specularIntensity;
		this.specularSharpness = src.specularSharpness;
	}

	// Token: 0x06000FD7 RID: 4055 RVA: 0x00073E14 File Offset: 0x00072014
	public virtual void BlendHSV(global::HSColorSet c01, global::HSColorSet c02, float rate)
	{
		this.hsvDiffuse = new global::HsvColor(Mathf.Lerp(c01.hsvDiffuse.H, c02.hsvDiffuse.H, rate), Mathf.Lerp(c01.hsvDiffuse.S, c02.hsvDiffuse.S, rate), Mathf.Lerp(c01.hsvDiffuse.V, c02.hsvDiffuse.V, rate));
		this.alpha = Mathf.Lerp(c01.alpha, c02.alpha, rate);
		this.hsvSpecular = new global::HsvColor(Mathf.Lerp(c01.hsvSpecular.H, c02.hsvSpecular.H, rate), Mathf.Lerp(c01.hsvSpecular.S, c02.hsvSpecular.S, rate), Mathf.Lerp(c01.hsvSpecular.V, c02.hsvSpecular.V, rate));
		this.specularIntensity = Mathf.Lerp(c01.specularIntensity, c02.specularIntensity, rate);
		this.specularSharpness = Mathf.Lerp(c01.specularSharpness, c02.specularSharpness, rate);
	}

	// Token: 0x06000FD8 RID: 4056 RVA: 0x00073F28 File Offset: 0x00072128
	public virtual void BlendRGB(global::HSColorSet c01, global::HSColorSet c02, float rate)
	{
		Color color = global::HsvColor.ToRgb(c01.hsvDiffuse);
		Color color2 = global::HsvColor.ToRgb(c02.hsvDiffuse);
		Color rgb = new Color(Mathf.Lerp(color.r, color2.r, rate), Mathf.Lerp(color.g, color2.g, rate), Mathf.Lerp(color.b, color2.b, rate));
		this.hsvDiffuse = global::HsvColor.FromRgb(rgb);
		this.alpha = Mathf.Lerp(c01.alpha, c02.alpha, rate);
		color = global::HsvColor.ToRgb(c01.hsvSpecular);
		color2 = global::HsvColor.ToRgb(c02.hsvSpecular);
		rgb = new Color(Mathf.Lerp(color.r, color2.r, rate), Mathf.Lerp(color.g, color2.g, rate), Mathf.Lerp(color.b, color2.b, rate));
		this.hsvSpecular = global::HsvColor.FromRgb(rgb);
		this.specularIntensity = Mathf.Lerp(c01.specularIntensity, c02.specularIntensity, rate);
		this.specularSharpness = Mathf.Lerp(c01.specularSharpness, c02.specularSharpness, rate);
	}

	// Token: 0x06000FD9 RID: 4057 RVA: 0x0007404C File Offset: 0x0007224C
	public virtual void Save(BinaryWriter writer)
	{
		writer.Write((double)this.hsvDiffuse.H);
		writer.Write((double)this.hsvDiffuse.S);
		writer.Write((double)this.hsvDiffuse.V);
		writer.Write((double)this.alpha);
		writer.Write((double)this.hsvSpecular.H);
		writer.Write((double)this.hsvSpecular.S);
		writer.Write((double)this.hsvSpecular.V);
		writer.Write((double)this.specularIntensity);
		writer.Write((double)this.specularSharpness);
	}

	// Token: 0x06000FDA RID: 4058 RVA: 0x000740EC File Offset: 0x000722EC
	public virtual void Load(BinaryReader reader, int version)
	{
		this.hsvDiffuse.H = (float)reader.ReadDouble();
		this.hsvDiffuse.S = (float)reader.ReadDouble();
		this.hsvDiffuse.V = (float)reader.ReadDouble();
		this.alpha = (float)reader.ReadDouble();
		this.hsvSpecular.H = (float)reader.ReadDouble();
		this.hsvSpecular.S = (float)reader.ReadDouble();
		this.hsvSpecular.V = (float)reader.ReadDouble();
		this.specularIntensity = (float)reader.ReadDouble();
		this.specularSharpness = (float)reader.ReadDouble();
	}

	// Token: 0x04001128 RID: 4392
	public const int SaveVersion = 1;

	// Token: 0x04001129 RID: 4393
	public global::HsvColor hsvDiffuse = new global::HsvColor(19f, 0.07f, 0.63f);

	// Token: 0x0400112A RID: 4394
	public float alpha = 1f;

	// Token: 0x0400112B RID: 4395
	public global::HsvColor hsvSpecular = new global::HsvColor(0f, 0f, 0.8f);

	// Token: 0x0400112C RID: 4396
	public float specularIntensity = 0.1f;

	// Token: 0x0400112D RID: 4397
	public float specularSharpness = 0.33f;
}
